package com.zxt.controller;

import com.zxt.pojo.Emp;
import com.zxt.pojo.LogInfo;
import com.zxt.pojo.Result;
import com.zxt.service.EmpService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RequestMapping("/login")
@RestController
public class LogController {
    @Autowired
    private EmpService empService;
    @PostMapping
    public Result Login(@RequestBody Emp emp){


        LogInfo logInfo =empService.Login(emp);
        if (logInfo != null){
            log.info("登录员工：{}" ,emp);

            return Result.success(logInfo);}
        else
            return Result.error("用户名或密码错误");
    }
}
